import request from "@/utils/request.js";
// 分页
export const pagingApi = (data) => {
	let option = {
		method: "POST",
		loading: true,
	};
	return request('api/sale/order/paging', data, option)
}

export const orderDetailApi = (id) => {
	let option = {
		method: "GET",
		loading: true,
	};
	return request('api/sale/order/' + id, null, option)
}
export const refundApi = (data) => {
	let option = {
		method: "POST",
		loading: true,
	};
	return request('api/sale/order/refund/list', data, option)
}
export const addRefund = (data) => {
	let option = {
		method: "POST",
		loading: true,
	};
	return request('api/sale/order/refund', data, option)
}
// 撤销退款
export const cancelApi = (data) => {
	let option = {
		method: "PUT",
		loading: true,
	};
	return request('api/sale/order/refund/cancel', data, option)
}

// 撤销退款
export const cancelOrderApi = (data) => {
	let option = {
		method: "PUT",
		loading: true,
	};
	return request('api/sale/order/cancel', data, option)
}

//获取课程价格列表
export const listCoursePrice = (courseId) => {
	let option = {
		method: "post",
		loading: true,
	};
	return request('api/sale/course/price/list', {
		courseId: courseId
	}, option)
}

//
export const treeCourse = (data) => {
	let option = {
		method: "get",
		loading: true,
	};
	return request('api/sale/course/second/level/tree/list', data, option)
}
//非免费科目
export const treePaidCourse = (data) => {
	let option = {
		method: "get",
		loading: true,
	};
	return request('api/sale/course/paid/second/level/tree/list', data, option)
}
//学员情况校验
export const checkStudent = (data, failHandle) => {
	let option = {
		method: "post",
		loading: true,
		failHandle: failHandle
	};
	return request('api/sale/order/item/check', data, option)
}

//提交订单
export const submitOrder = (data, failHandle) => {
	let option = {
		method: "post",
		loading: true,
		failHandle: failHandle
	};
	return request('api/sale/order', data, option)
}

//获取配置信息
export const getConfig = (code) => {
	let option = {
		method: "get",
		loading: false
	};
	return request('api/conf/' + code, null, option)
}


//获取配置信息
export const listStudent = (data) => {
	let option = {
		method: "post",
		loading: true
	};
	return request('api/sale/order/item/list', data, option)
}

//获取配置信息
export const payOffline = (data) => {
	let option = {
		method: "POST",
		loading: true
	};
	return request('api/sale/order/offline/pay', data, option)
}